package cn.xxstudy.visitshop.ui.activity.main.fragment.train.viewmodel

import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import cn.xxstudy.visitshop.ui.activity.main.fragment.train.model.TrainData
import kotlinx.coroutines.flow.Flow

/**
 * @author ：DELL on 2021/3/26 .
 * @packages ：cn.xxstudy.visitshop.ui.activity.main.fragment.train.viewmodel .
 * TODO:仓库
 */
object TrainRepository {
    private const val pageSize = 8
    fun getPagingData(): Flow<PagingData<TrainData>> {
        return Pager(
            //首次加载的数量:最终会被乘以3，为了使能够具有足够滑动的数据
            config = PagingConfig(pageSize),
            pagingSourceFactory = { TrainPagingSource() }).flow
    }
}